#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include "b64.h"

int
main (void) {
  FILE* fp = fopen("demo.aac", "rb");
  fseek(fp, 0, SEEK_END);
  int fsize = ftell(fp);
  const uint8_t* str = (uint8_t*)malloc(fsize);
    memset(str, 0, fsize);
    fseek(fp, 0, SEEK_SET);
    fread(str, fsize, 1, fp);
    printf("str:%X fsize:%d\n", (uint64_t)str, fsize);
  char *enc = b64_encode(str, fsize);
//    for (int i = 0; i < fsize; i++)
//    {
//        printf("%02X ", enc[i]);
//    }
//    printf("%02X %02X\n", enc); // YnJpYW4gdGhlIG1vbmtleSBhbmQgYnJhZGxleSB0aGUga2lua2Fqb3UgYXJlIGZyaWVuZHM=
    printf("%s\n", enc);
    printf("\n=============\n");
    
  char *dec = b64_decode(enc, strlen(enc));

  //printf("%s\n", dec); // brian the monkey and bradley the kinkajou are friends
  free(enc);
  free(dec);
  return 0;
}

